import req from "@/uni-sdk/request/request.js";

export const Api = {
	login: "zyx-auth/oauth2/token",
	me: "zyx-system/api/v1/users/me",
};

export function handleLogin(data) {
	data.grant_type = "password";
	return uni.uploadFile({
		url: getApp().globalData.common.baseUrl + Api.login,
		filePath: '',
		name: '',
		header: {
			Authroization: "Basic enl4LWFkbWluOjEyMzQ1Ng==",
		},
		formData: data,
	})

	// const formData = new FormData();
	// formData.append("username", data.username);
	// formData.append("password", data.password);
	// formData.append("grant_type", "password");
	// data.grant_type = "password";
	//  return req.post(
	//    {
	//      url: Api.login,
	//      auth: {
	//        username: "zyx-admin",
	//        password: "123456",
	//      },
	//      data,
	//    },
	//    {
	//      withToken: false,
	//    }
	//  );
}